<template>
	<div class="container">

		<el-table height="500" border style="width: 100%" v-loading="dataset.loading" :data="dataset.items" class="el-mb-15" stripe>
			<el-table-column prop="ordernumber" label="订单号" />
			<el-table-column prop="username" label="下单人" />
			<el-table-column prop="znumber" label="总重量(KG)" />
			<el-table-column prop="price" label="总价格" />
			<el-table-column prop="create_time" label="下单时间" />
			<el-table-column type="selection" width="55"></el-table-column>
		</el-table>
		<el-button class="btn"  @click="onSubmit()" v-show="see">确定</el-button>
	</div>
</template>

<script>
	import {
		Table, TableColumn, Pagination,
		Button, Select, Option,
		Drawer, Dialog,
		MessageBox, Message
	} from 'element-ui';

	export default {
		components: {
			[Table.name]: Table, [TableColumn.name]: TableColumn, [Pagination.name]: Pagination,
			[Button.name]: Button, [Select.name]: Select, [Option.name]: Option,
			[Drawer.name]: Drawer, [Dialog.name]: Dialog,
		},
		data() {
			return {
				dataset: {
					loading: false,
					total: 0, limit: 10, page: 1,
					items: [],
					list:[]
				},
				see:true
			}
		},
		mounted() {
			this.controllerRequestListDataset();
			if(this.dataset.items.length==0){
				this.see=false
			}else{
				this.see=true
			}
		},
		methods: {
			controllerRequestListDataset(page) {
				if (this.dataset.loading) return; else this.dataset.loading = true;
				if (page) this.dataset.page = page;

				var url = '/api/admin/order/getlist',
					params = {
                        page: this.dataset.page - 1, list_rows: this.dataset.limit, type: "allout",
						token: this.$store.state.options.user.token,
						otype:1
					};

				this.$util.postRequestInterface(url, params, {
					success: (res) => {
                        this.dataset.total = res.data.count;
						this.dataset.items = res.data.data.map((data, index, arr) => {
                            data.create_time = this.$moment(parseInt(data.create_time) * 1000).format('YYYY-MM-DD HH:mm:ss');
                            return data;
                        });
					},
					complete: (e) => {
						this.dataset.loading = false;
					}
				});
			},
			eventUpdateRequestLimit(limit) {
				if (this.dataset.loading) return;

				this.dataset.limit = limit;
				this.dataset.page = 1;
				this.dataset.total = 0;

				this.controllerRequestListDataset();
			},
			onSubmit(){
				alert("出库成功")
			},
		}
	}
</script>

<style lang="scss" scoped>
.btn{
	display: block;
	margin: 0 auto;
	width: 100px;
}
.el-checkbox__input.is-disabled .el-checkbox__inner{
	border-color: red !important 
}
.el-button{
	border:1px solid red
}
</style>

